package geograph.china;

/**
 * Title:
 * Created by Myth on 2017/8/17.
 */
public class District {
    private String districtCode;
    private String districtName;
    private String districtEnglishName;

    public District(String districtCode, String districtName, String districtEnglishName) {
        this.districtCode = districtCode;
        this.districtName = districtName;
        this.districtEnglishName = districtEnglishName;
    }

    public String getDistrictEnglishName() {
        return districtEnglishName;
    }

    @Override
    public boolean equals(Object o) {
        if (this == o) return true;
        if (o == null || getClass() != o.getClass()) return false;

        District district = (District) o;

        if (districtCode != null ? !districtCode.equals(district.districtCode) : district.districtCode != null)
            return false;
        if (districtName != null ? !districtName.equals(district.districtName) : district.districtName != null)
            return false;
        return districtEnglishName != null ? districtEnglishName.equals(district.districtEnglishName) : district.districtEnglishName == null;
    }

    @Override
    public int hashCode() {
        int result = districtCode != null ? districtCode.hashCode() : 0;
        result = 31 * result + (districtName != null ? districtName.hashCode() : 0);
        result = 31 * result + (districtEnglishName != null ? districtEnglishName.hashCode() : 0);
        return result;
    }

    @Override
    public String toString() {
        return "{\"name\":\"" + districtName +"\", \"english_name\":\"" + districtEnglishName + "\"}";
    }
}

